import { useDispatch, useSelector } from "react-redux";
import { increment,incrementAsync } from "./counterSlice";
export default function Counter() {
  const count = useSelector((state) => state.counter.value);
  const dispatch = useDispatch();
  return (
    <>
      <div>
        <div>{count}</div>
        <button onClick={() => dispatch(increment())}>同步+1</button>
        <button onClick={() => dispatch(incrementAsync())}>异步+1</button>
      </div>
    </>
  );
}
